package com.leyou.mall.data.entity;

import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author 车矣捕
 * @version 1.0
 * @description: 接口统一返回包装类
 * @date 2022/4/19 16:46
 */
@Data
@AllArgsConstructor
public class Result {

    private Integer code;
    private String msg;
    private Object data;

    public Result(){

    }

    public static Result success() {
        return new Result(200,"",null);
    }

    public static Result success(Object data) {
        return new Result(200,"",data);
    }

    public static Result error(Integer code, String msg) {
        return new Result(code, msg, null);
    }

    public static Result error() {
        return new Result(500, "系统错误", null);
    }
}
